package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.page.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author ffk
 * @since 2024-06-25
 */
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
public class InteractionReplyController {
    private final IInteractionReplyService service;


    /**
     * 用户新增回答或评论
     *
     * @param replyDTO
     */
    @ApiOperation("用户新增回答或评论")
    @PostMapping
    public void saveReply(@Valid @RequestBody ReplyDTO replyDTO) {
        service.saveReply(replyDTO);
    }

    /**
     * 用户端端分页查询回答或者评论列表
     */
    @ApiOperation("用户端端分页查询回答或者评论列表")
    @GetMapping("page")
    public PageDTO<ReplyVO> pageQueryReply(ReplyPageQuery replyPageQuery) {
        return service.userPageQueryReply(replyPageQuery);
    }
}
